﻿using System.Collections.Generic;
using System.Text;

namespace smp.QueryDb
{
    internal class Command : ICommand
    {
        private readonly StringBuilder _command;
        private readonly List<IParameter> _parameters;

        internal Command()
        {
            _command = new StringBuilder();
            _parameters = new List<IParameter>();
        }

        #region Implementation of ICommand

        public IList<IParameter> Parameters { get { return _parameters; } }

        public string CommandText { get { return _command.ToString(); } }

        #endregion

        internal StringBuilder CommandBuilder { get { return _command; } }

        internal void AddParameter(IParameter parameter)
        {
            _parameters.Add(parameter);
        }

        internal void AddParameters(IList<IParameter> parameters)
        {
            _parameters.AddRange(parameters);
        }
    }
}